<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>return</title>
    <script src="../js/admin_change.js"></script>
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/admin_change.css"/>
    <link rel="stylesheet" type="text/css" href="../css/template.css"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="../css/admin_index.css"/>
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script type="text/javascript">
        $(document).ready(function(){
            $.ajax({
                type:"get",
                dataType:'text',
                url:"/admin/get_set", //页面加载函数 获取当前值
                success:function (data) {
                    var retData = eval("(" + data + ")");
                    $("#f").val(retData.fine);
                    $("#re").val(retData.return_time);
                    $("#d").val(retData.deposit);
                }
            })
        });


        $(function () {
            $("#btnrefresh").on('click',function () {
                $.ajax({
                    url:"/admin/modify_set",  //页面修改给后端传值
                    type:"post",
                    data:
                    {
                        "fine":$("#f").val(),
                        "return_time": $("#re").val(),
                        "deposit" : $("#d").val()
                    }
                }).done(function (data){
                    if(data)
                        alert("successful");
                    else
                        alert("Database does not exist");
                }).fail(function(XMLHttpRequest, textStatus, errorThrown){
                    alert("Button failure");
                });
            })
        })
    </script>

</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="background-color: black">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" style="color: white;font-family: 'Arial Narrow';float: left;margin-right: 100px"><i class="fa fa-cloud fa-lg"></i>Library</a>
            <a class="navbar-brand" href="/reader_searchbook(no)" style="color: white;float: left;margin-right: 100px">Home</a>
            <a class="navbar-brand" href="/admin/tochange" style="color: white;float: left;margin-right: 100px">About me</a>
            <a class="navbar-brand" href="/admin/brarianaccount" style="color: white;float: left;margin-right: 100px">Acount information</a>
        </div>
        <ul class="nav navbar-nav navbar-right">
            <!--            <li><a href="#" style="color: white"><span class="glyphicon glyphicon-user" style="color: white"></span>Sign in</a></li>-->
            <li><a href="/admin/basereturn" style="color: white"><span class="glyphicon glyphicon-cog" style="color: white">Set</span></a></li>
            <li><a href="/admin/logout" style="color: white"><span class="glyphicon glyphicon-log-out" style="color: white"></span>Log out</a></li>

        </ul>
    </div>
</nav>
<div class="admin_regin_back"  >
    <div style="width: 400px; height: 400px;position: absolute;top:200px;left: 500px;">
        <div style="width: 500px; height: 100px;position: absolute">
            <font size="5">You can change the following values</font>
        </div>

        <table style="height: 300px ;width: 400px;left: 50px;top: 30px;position: absolute">
            <tr>
                <td><font size="4">Fine</font></td>
                <td >
                    <input type="text" id="f" name="fine"  readonly="readonly" value="">
                </td>
                <td><font size="4">yuan/day</font></td>
            </tr>
            <tr>
                <td><font size="4">return time</font> </td>
                <td >
                    <input type="text" id="re" name="rt"  readonly="readonly"/>
                </td>
                <td><font size="4">day</font></td>
            </tr>
            <tr>
                <td><font size="4">deposit</font></td>
                <td>
                    <input type="text" id="d" name="deposit"  readonly="readonly">
                </td>
                <td><font size="4">yuan</font></td>
            </tr>
            <tr>
                <td>
                    <div>
                        <button type="button" onclick="edit2()" style="margin-right: 50px;width: 40px;color: white;background: black;border-color: black">Edit</button>
                        <button type="button" id="btnrefresh"  style="color: white;background: black;border-color: black" >Save</button>
                    </div>
                </td>
            </tr>
        </table>

    </div>
</div>
<div>
    <div class="footer">
        <div>
            <img src="../images/mandarin.png"  class="mandarin">
        </div>
        <p>Shan ICP Number 18018134 | Powered by 1713011</p>
    </div>
</div>


</body>
</html>